<?php
/**
 * Created by PhpStorm.
 * User: qingyun
 * Date: 17/4/13
 * Time: 下午7:00
 */
namespace Common\Controller;

class AdminBaseController extends BaseController{
    public function _initialize(){
        parent::_initialize();
        if(!isset($_SESSION['user']['id'])){
            $this -> error('请重新登录',U('Admin/Login/index'));
        }
        $auth = new \Think\Auth();
        $rule_name = MODULE_NAME.'/'.CONTROLLER_NAME.'/'.ACTION_NAME;

        $id = $_SESSION['user']['id'];
        if(!$auth->check($rule_name,$id) && $id != 1){
            $this->error('您没有权限访问！');
        };
    }
}